%ifndef BOOT_PROTECTEDMODEUTILITY_PRINT
%define BOOT_PROTECTEDMODEUTILITY_PRINT
%include "Boot/Segmentation.S"
; 以同一种颜色打印字符
; Print(void* lpBuffer, const unsigned char* lpString, DWORD dwColor)
%define lpBuffer [ebp + 36]
%define lpString [ebp + 40]
%define dwColor [ebp + 44]
bits 32
Boot.ProtectedModeUtility.Print:
    pushad
    mov ebp, esp ; 栈底
    mov ax, SEGMENT_SELECTOR_GRAPHIC_TEXT_MODE
    mov gs, ax
    mov ah, dwColor ; 高位保存颜色
    mov esi, lpString ; 字符串首地址
    mov ebx, lpBuffer ; 显存地址
Boot.ProtectedModeUtility.Print.PutChar:
    mov al, [esi] ; 取出一个字符
    inc esi
    cmp al, 0x00 ; 是否为 NUL 字符
    je Boot.ProtectedModeUtility.Print.Return
    mov [gs:ebx], ax ; 写入显存单元
    add ebx, 2
    jmp Boot.ProtectedModeUtility.Print.PutChar
Boot.ProtectedModeUtility.Print.Return:
    popad
    ret
%undef lpBuffer
%undef lpString
%undef dwColor
%endif